IOError: [Errno 32] Broken pipe

Posted by khati on Server Fault See other posts from Server Fault or by khati
Published on 2011-05-13T09:59:22Z Indexed on 2012/06/11 4:42 UTC
Read the original article Hit count: 694

Filed under:
|

I got "IOError: [Errno 32] Broken pipe" while writing files in linux.

I am using python to read each line a of csv file and then write into a database table. My code is

f = open(path,'r') 

command = command to connect to database

p = Popen(command, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE, env=env)

query = " COPY myTable( id, name, address) FROM STDIN WITH  DELIMITER ';' CSV QUOTE   '"'; "

p.stdin.write(query.encode('ascii')) *-->(Here exactly I got the error, p.stdin.write(query.encode('ascii'))
    IOError: [Errno 32] Broken pipe )*

So when I run this program in linux, I got error "IOError: [Errno 32] Broken pipe" . However this works fine when I run in windows7.

Do I need to do some configuration in Linux sever?

Any suggestions will be appreciated. Thank you.

© Server Fault or respective owner

Related posts about linux

Related posts about python